<template>
	<view class="menu-right">
		<!-- 顶部 -->
		<u-sticky z-index="1">
			<view style="background: #fff;" >
				<view>
					<view class="time">{{ menus.type == 1 ? '午餐' : '晚餐' }}</view>
				</view>
				<stop-time v-if="stopTime" :stopTime="stopTime"></stop-time>
			</view>
		</u-sticky>
		
		<!-- 菜单 -->
		<menu-list v-if="selectExptxt" :menuList="selectExptxt.content" ref="menuList"></menu-list>
		
		<!-- 底部按钮 -->
		<bottom-btn></bottom-btn>
	</view>
</template>

<script>
	import menuList from "./components/menuList.vue"
	import stopTime from "./components/stopTime.vue"
	import bottomBtn from "./components/bottomBtn.vue"

	export default {
		props:{
			selectExptxt:{
				
			},
			menus:{
				
			},
			enterprise:{
				
			}
		},
		components: {
			menuList,
			stopTime,
			bottomBtn
		},
		data() {
			return {
				// selectExptxt: "", //选中套餐
				// menus: "", //全部套餐
				// enterprise: "", //企业信息
				time: new Date().getHours(), //当前小时
				stopTime:""//截单时间
			}
		},
		methods: {
			getStopTime(menus,enterprise) {
				//获取截单时间
				if (menus.type === 1) {//午餐
					this.stopTime = enterprise.lchend;
				} else {//晚餐
					this.stopTime = enterprise.dnrend;
				}
			}
		},
		created() {
			// this.$eventBus.$on("selectExptxt", (val) => {
			// 	console.log(val.selectExptxt)
			// 	this.selectExptxt = val.selectExptxt //选中套餐
				
			// 	this.menus = val.menus //全部套餐
			// 	this.enterprise = val.enterprise //企业信息
			// 	// console.log(this.menus)
			// 	// console.log(this.enterprise)
			// 	this.getStopTime(this.menus,this.enterprise)//获取截单时间
			// })
			this.getStopTime(this.menus,this.enterprise)//获取截单时间
		}
	}
</script>

<style lang="scss" scoped>
	.menu-right {
		margin-right: -5px;
	
		.time {
			padding: 20rpx 0;
			font-size: 34rpx;
			text-align: center;
			background: linear-gradient(#fde054, #ffc756);
			border-top-left-radius: 25rpx;
		}
	
		.loading {
			width: 100%;
			height: 50vh;
			background-color: #ffffff;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	
		.menuList {
			//菜单
			.active {
				//高亮
				display: block;
			}
	
			.noActive {
				//非高亮
				display: none;
			}
		}
	}
</style>
